<?php
function __autoload($class_name) {
    include '../class/' . $class_name . '.php';
}
?>
<?php include("functions.php"); ?>
<?php include("connection.php"); ?>
<?php $settings = new Settings(); ?>

<?php
	if(isset($_GET['position'])) {
		$niz = getAllPlayersByPosition($_GET['position']);
		if (count($niz)) {
			foreach($niz as $igrac) {
				$igrac->getAllStats();
				$igrac->calculateTotalStats();
				//sortPlayers($niz, "BLindex");
				?>
                <div class="transferPlayerInfo">
                	<div class="transferPlayerImg">
                    	<img width="30" src="media/players/<?= $igrac->slika ?>" />
                    </div>
                    <div class="transferPlayerName">
                        <a class="transferPlayerA" rel="<?= $igrac->id ?>-<?= $_GET['position'] ?>"><?php echo $igrac->ime, " ", $igrac->prezime; ?></a><br />
						<span><?php echo $igrac->getTeamInfo()->ime; ?></span>
                    </div>
                    <div class="transferPlayerPts">
                    	<?php echo $igrac->totalStats->BLindex; ?>
                    </div>
                </div>
                <?php
			}
		}
		else {
			echo "No players on that position";
		}
	}	
?>